#ifndef TRANSLATION_H
#define TRANSLATION_H

#include <QObject>
#include <QtGui>
#include <QDebug>
#include <QQuickView>
#include <QQmlContext>
#include <QQmlEngine>

class Translation : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString family READ family WRITE setFamily NOTIFY familyChanged)

public:
    Translation(QQuickView *view);
    ~Translation();

    Q_INVOKABLE void updateLanguage(int language);

    const QString &family() const;
    void setFamily(const QString &newFamily);

signals:
    void languageChanged();
    void familyChanged();

private:
    QTranslator *m_translator;
    QQuickView *m_view;
    QString m_family;

private:
    void initLanguage();
    void changedSystemLanguage(int language);
    void reloadFontFimily(int language = 0);
};

#endif // TRANSLATION_H
